<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<style>
   .a{
      width: 100px;
      height: 60px;
      background: black;
      position: relative;
      z-index: 4  /* 谁的Z轴属性值大，谁在上面 */
    }
    .b{
      width: 100px;
      height: 60px;
      background: blue;
      position: relative;
      top: -20px;
      left: 20px;
      z-index: 2  /* 谁的Z轴属性值大，谁在上面 */
    }
</style>

<body>
    <div class="a">1</div>
    <div class="b">2</div>
</body>
</html>